package com.monster.controller;

import com.monster.dto.CheckGroupDTO;
import com.monster.entity.QueryPageBean;
import com.monster.entity.Result;
import com.monster.service.CheckGroupService;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

@RestController
public class CheckGroupController {
    @Reference
    CheckGroupService checkGroupService;

    @GetMapping("web/checkgroup/findAll")
    public Result findAll(){
        return new Result(checkGroupService.list());
    }

    //检查组项目管理
    @PostMapping("web/checkgroup/findPage")
    public Result findPage(@RequestBody QueryPageBean queryPageBean){
       return new Result(checkGroupService.findPage(queryPageBean));
    }
    //检查组添加或者修改
    @PostMapping("web/checkgroup/addOrUpdata")
    public Result addOrUpdata(@RequestBody CheckGroupDTO CheckGroupDTO){
        return new Result(checkGroupService.addOrUpdataCheckGroupDTO(CheckGroupDTO));
    }
    //编辑的数据回显
    @GetMapping("web/checkgroup/showDataByGid/{id}")
    public Result showDataByGid(@PathVariable("id") int id){
        return new Result(checkGroupService.showDataByGid(id));
    }

    @DeleteMapping("web/checkgroup/deleteById/{id}")
    public Result deleteById(@PathVariable("id") int id){
        return new Result(checkGroupService.deleteById(id));
    }

}
